package com.example.Data;

import java.util.ArrayList;
import java.util.List;

public class GenericTest {

    public static void main(String[] args) {
        List<Integer> IntList = new ArrayList<Integer>();
        List<String> StringList = new ArrayList<String>();
        List<Double> DouList = new ArrayList<Double>();

        IntList.add(1);
        StringList.add("Hello");
        DouList.add(2.0);

        getData(IntList);
//        getUperNumber(StringList); // 类型不通过
        getData(StringList);
        getUperNumber(DouList);
    }
    public static void getData(List<?> data){
        System.out.println("data :"+data.get(0));
    }
    public static void getUperNumber(List<? extends Number> data) {
        System.out.println("data :" + data.get(0));
    }
}
